<?php

class Consignee_linkman_info extends CActiveRecord
{
	/**
	 * The followings are the available columns in table 'Consignee_linkman_info':
	 * @var integer $id
	 * @var string $addr
	 * @var string $name
	 * @var string $mobile_no
	 * @var string $rule
	 * @var integer $fk_consignee_id
	 * @var integer $state
	 * @var string $create_time
	 */

	/**
	 * Returns the static model of the specified AR class.
	 * @return CActiveRecord the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'consignee_linkman_info';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		return array(
			array('addr','length','max'=>100),
			array('name','length','max'=>30),
			array('mobile_no','length','max'=>18),
			array('rule','length','max'=>300),
			array('name,mobile_no,addr', 'required'),
		);
	}

	/**
	 * Prepares attributes before performing validation.
	 */
	protected function beforeValidate($on)
	{
		if($this->isNewRecord){
			$this->state=0;
			$this->create_time=date('Y-m-d G:i:s');
		}
		return true;
	}
	
	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'id' => '索引号',
			'addr' => '卸货地址',
			'name' => '联系人姓名',
			'mobile_no' => '联系人手机',
			'rule' => '卸货地规定',
			'fk_consignee_id' => '客户Id',
			'state' => '状态',
			'create_time' => '创建时间',
		);
	}
}